/*
 * An XML document type.
 * Localname: event
 * Namespace: urn:jbpm.org:jpdl-3.2
 * Java type: x2.orgJpdl3.jbpm.EventDocument
 *
 * Automatically generated - do not modify.
 */
package x2.orgJpdl3.jbpm.impl;
/**
 * A document containing one event(@urn:jbpm.org:jpdl-3.2) element.
 *
 * This is a complex type.
 */
public class EventDocumentImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements x2.orgJpdl3.jbpm.EventDocument
{
    private static final long serialVersionUID = 1L;
    
    public EventDocumentImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName EVENT$0 = 
        new javax.xml.namespace.QName("urn:jbpm.org:jpdl-3.2", "event");
    
    
    /**
     * Gets the "event" element
     */
    public x2.orgJpdl3.jbpm.EventDocument.Event getEvent()
    {
        synchronized (monitor())
        {
            check_orphaned();
            x2.orgJpdl3.jbpm.EventDocument.Event target = null;
            target = (x2.orgJpdl3.jbpm.EventDocument.Event)get_store().find_element_user(EVENT$0, 0);
            if (target == null)
            {
                return null;
            }
            return target;
        }
    }
    
    /**
     * Sets the "event" element
     */
    public void setEvent(x2.orgJpdl3.jbpm.EventDocument.Event event)
    {
        synchronized (monitor())
        {
            check_orphaned();
            x2.orgJpdl3.jbpm.EventDocument.Event target = null;
            target = (x2.orgJpdl3.jbpm.EventDocument.Event)get_store().find_element_user(EVENT$0, 0);
            if (target == null)
            {
                target = (x2.orgJpdl3.jbpm.EventDocument.Event)get_store().add_element_user(EVENT$0);
            }
            target.set(event);
        }
    }
    
    /**
     * Appends and returns a new empty "event" element
     */
    public x2.orgJpdl3.jbpm.EventDocument.Event addNewEvent()
    {
        synchronized (monitor())
        {
            check_orphaned();
            x2.orgJpdl3.jbpm.EventDocument.Event target = null;
            target = (x2.orgJpdl3.jbpm.EventDocument.Event)get_store().add_element_user(EVENT$0);
            return target;
        }
    }
    /**
     * An XML event(@urn:jbpm.org:jpdl-3.2).
     *
     * This is a complex type.
     */
    public static class EventImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements x2.orgJpdl3.jbpm.EventDocument.Event
    {
        private static final long serialVersionUID = 1L;
        
        public EventImpl(org.apache.xmlbeans.SchemaType sType)
        {
            super(sType);
        }
        
        private static final javax.xml.namespace.QName ACTION$0 = 
            new javax.xml.namespace.QName("urn:jbpm.org:jpdl-3.2", "action");
        private static final javax.xml.namespace.QName SCRIPT$2 = 
            new javax.xml.namespace.QName("urn:jbpm.org:jpdl-3.2", "script");
        private static final javax.xml.namespace.QName CREATETIMER$4 = 
            new javax.xml.namespace.QName("urn:jbpm.org:jpdl-3.2", "create-timer");
        private static final javax.xml.namespace.QName CANCELTIMER$6 = 
            new javax.xml.namespace.QName("urn:jbpm.org:jpdl-3.2", "cancel-timer");
        private static final javax.xml.namespace.QName MAIL$8 = 
            new javax.xml.namespace.QName("urn:jbpm.org:jpdl-3.2", "mail");
        private static final javax.xml.namespace.QName TYPE$10 = 
            new javax.xml.namespace.QName("", "type");
        
        
        /**
         * Gets a List of "action" elements
         */
        public java.util.List<x2.orgJpdl3.jbpm.ActionDocument.Action> getActionList()
        {
            final class ActionList extends java.util.AbstractList<x2.orgJpdl3.jbpm.ActionDocument.Action>
            {
                public x2.orgJpdl3.jbpm.ActionDocument.Action get(int i)
                    { return EventImpl.this.getActionArray(i); }
                
                public x2.orgJpdl3.jbpm.ActionDocument.Action set(int i, x2.orgJpdl3.jbpm.ActionDocument.Action o)
                {
                    x2.orgJpdl3.jbpm.ActionDocument.Action old = EventImpl.this.getActionArray(i);
                    EventImpl.this.setActionArray(i, o);
                    return old;
                }
                
                public void add(int i, x2.orgJpdl3.jbpm.ActionDocument.Action o)
                    { EventImpl.this.insertNewAction(i).set(o); }
                
                public x2.orgJpdl3.jbpm.ActionDocument.Action remove(int i)
                {
                    x2.orgJpdl3.jbpm.ActionDocument.Action old = EventImpl.this.getActionArray(i);
                    EventImpl.this.removeAction(i);
                    return old;
                }
                
                public int size()
                    { return EventImpl.this.sizeOfActionArray(); }
                
            }
            
            synchronized (monitor())
            {
                check_orphaned();
                return new ActionList();
            }
        }
        
        /**
         * Gets array of all "action" elements
         * @deprecated
         */
        public x2.orgJpdl3.jbpm.ActionDocument.Action[] getActionArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                java.util.List<x2.orgJpdl3.jbpm.ActionDocument.Action> targetList = new java.util.ArrayList<x2.orgJpdl3.jbpm.ActionDocument.Action>();
                get_store().find_all_element_users(ACTION$0, targetList);
                x2.orgJpdl3.jbpm.ActionDocument.Action[] result = new x2.orgJpdl3.jbpm.ActionDocument.Action[targetList.size()];
                targetList.toArray(result);
                return result;
            }
        }
        
        /**
         * Gets ith "action" element
         */
        public x2.orgJpdl3.jbpm.ActionDocument.Action getActionArray(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.ActionDocument.Action target = null;
                target = (x2.orgJpdl3.jbpm.ActionDocument.Action)get_store().find_element_user(ACTION$0, i);
                if (target == null)
                {
                    throw new IndexOutOfBoundsException();
                }
                return target;
            }
        }
        
        /**
         * Returns number of "action" element
         */
        public int sizeOfActionArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                return get_store().count_elements(ACTION$0);
            }
        }
        
        /**
         * Sets array of all "action" element
         */
        public void setActionArray(x2.orgJpdl3.jbpm.ActionDocument.Action[] actionArray)
        {
            synchronized (monitor())
            {
                check_orphaned();
                arraySetterHelper(actionArray, ACTION$0);
            }
        }
        
        /**
         * Sets ith "action" element
         */
        public void setActionArray(int i, x2.orgJpdl3.jbpm.ActionDocument.Action action)
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.ActionDocument.Action target = null;
                target = (x2.orgJpdl3.jbpm.ActionDocument.Action)get_store().find_element_user(ACTION$0, i);
                if (target == null)
                {
                    throw new IndexOutOfBoundsException();
                }
                target.set(action);
            }
        }
        
        /**
         * Inserts and returns a new empty value (as xml) as the ith "action" element
         */
        public x2.orgJpdl3.jbpm.ActionDocument.Action insertNewAction(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.ActionDocument.Action target = null;
                target = (x2.orgJpdl3.jbpm.ActionDocument.Action)get_store().insert_element_user(ACTION$0, i);
                return target;
            }
        }
        
        /**
         * Appends and returns a new empty value (as xml) as the last "action" element
         */
        public x2.orgJpdl3.jbpm.ActionDocument.Action addNewAction()
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.ActionDocument.Action target = null;
                target = (x2.orgJpdl3.jbpm.ActionDocument.Action)get_store().add_element_user(ACTION$0);
                return target;
            }
        }
        
        /**
         * Removes the ith "action" element
         */
        public void removeAction(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                get_store().remove_element(ACTION$0, i);
            }
        }
        
        /**
         * Gets a List of "script" elements
         */
        public java.util.List<x2.orgJpdl3.jbpm.ScriptDocument.Script> getScriptList()
        {
            final class ScriptList extends java.util.AbstractList<x2.orgJpdl3.jbpm.ScriptDocument.Script>
            {
                public x2.orgJpdl3.jbpm.ScriptDocument.Script get(int i)
                    { return EventImpl.this.getScriptArray(i); }
                
                public x2.orgJpdl3.jbpm.ScriptDocument.Script set(int i, x2.orgJpdl3.jbpm.ScriptDocument.Script o)
                {
                    x2.orgJpdl3.jbpm.ScriptDocument.Script old = EventImpl.this.getScriptArray(i);
                    EventImpl.this.setScriptArray(i, o);
                    return old;
                }
                
                public void add(int i, x2.orgJpdl3.jbpm.ScriptDocument.Script o)
                    { EventImpl.this.insertNewScript(i).set(o); }
                
                public x2.orgJpdl3.jbpm.ScriptDocument.Script remove(int i)
                {
                    x2.orgJpdl3.jbpm.ScriptDocument.Script old = EventImpl.this.getScriptArray(i);
                    EventImpl.this.removeScript(i);
                    return old;
                }
                
                public int size()
                    { return EventImpl.this.sizeOfScriptArray(); }
                
            }
            
            synchronized (monitor())
            {
                check_orphaned();
                return new ScriptList();
            }
        }
        
        /**
         * Gets array of all "script" elements
         * @deprecated
         */
        public x2.orgJpdl3.jbpm.ScriptDocument.Script[] getScriptArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                java.util.List<x2.orgJpdl3.jbpm.ScriptDocument.Script> targetList = new java.util.ArrayList<x2.orgJpdl3.jbpm.ScriptDocument.Script>();
                get_store().find_all_element_users(SCRIPT$2, targetList);
                x2.orgJpdl3.jbpm.ScriptDocument.Script[] result = new x2.orgJpdl3.jbpm.ScriptDocument.Script[targetList.size()];
                targetList.toArray(result);
                return result;
            }
        }
        
        /**
         * Gets ith "script" element
         */
        public x2.orgJpdl3.jbpm.ScriptDocument.Script getScriptArray(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.ScriptDocument.Script target = null;
                target = (x2.orgJpdl3.jbpm.ScriptDocument.Script)get_store().find_element_user(SCRIPT$2, i);
                if (target == null)
                {
                    throw new IndexOutOfBoundsException();
                }
                return target;
            }
        }
        
        /**
         * Returns number of "script" element
         */
        public int sizeOfScriptArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                return get_store().count_elements(SCRIPT$2);
            }
        }
        
        /**
         * Sets array of all "script" element
         */
        public void setScriptArray(x2.orgJpdl3.jbpm.ScriptDocument.Script[] scriptArray)
        {
            synchronized (monitor())
            {
                check_orphaned();
                arraySetterHelper(scriptArray, SCRIPT$2);
            }
        }
        
        /**
         * Sets ith "script" element
         */
        public void setScriptArray(int i, x2.orgJpdl3.jbpm.ScriptDocument.Script script)
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.ScriptDocument.Script target = null;
                target = (x2.orgJpdl3.jbpm.ScriptDocument.Script)get_store().find_element_user(SCRIPT$2, i);
                if (target == null)
                {
                    throw new IndexOutOfBoundsException();
                }
                target.set(script);
            }
        }
        
        /**
         * Inserts and returns a new empty value (as xml) as the ith "script" element
         */
        public x2.orgJpdl3.jbpm.ScriptDocument.Script insertNewScript(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.ScriptDocument.Script target = null;
                target = (x2.orgJpdl3.jbpm.ScriptDocument.Script)get_store().insert_element_user(SCRIPT$2, i);
                return target;
            }
        }
        
        /**
         * Appends and returns a new empty value (as xml) as the last "script" element
         */
        public x2.orgJpdl3.jbpm.ScriptDocument.Script addNewScript()
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.ScriptDocument.Script target = null;
                target = (x2.orgJpdl3.jbpm.ScriptDocument.Script)get_store().add_element_user(SCRIPT$2);
                return target;
            }
        }
        
        /**
         * Removes the ith "script" element
         */
        public void removeScript(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                get_store().remove_element(SCRIPT$2, i);
            }
        }
        
        /**
         * Gets a List of "create-timer" elements
         */
        public java.util.List<x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer> getCreateTimerList()
        {
            final class CreateTimerList extends java.util.AbstractList<x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer>
            {
                public x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer get(int i)
                    { return EventImpl.this.getCreateTimerArray(i); }
                
                public x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer set(int i, x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer o)
                {
                    x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer old = EventImpl.this.getCreateTimerArray(i);
                    EventImpl.this.setCreateTimerArray(i, o);
                    return old;
                }
                
                public void add(int i, x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer o)
                    { EventImpl.this.insertNewCreateTimer(i).set(o); }
                
                public x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer remove(int i)
                {
                    x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer old = EventImpl.this.getCreateTimerArray(i);
                    EventImpl.this.removeCreateTimer(i);
                    return old;
                }
                
                public int size()
                    { return EventImpl.this.sizeOfCreateTimerArray(); }
                
            }
            
            synchronized (monitor())
            {
                check_orphaned();
                return new CreateTimerList();
            }
        }
        
        /**
         * Gets array of all "create-timer" elements
         * @deprecated
         */
        public x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer[] getCreateTimerArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                java.util.List<x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer> targetList = new java.util.ArrayList<x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer>();
                get_store().find_all_element_users(CREATETIMER$4, targetList);
                x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer[] result = new x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer[targetList.size()];
                targetList.toArray(result);
                return result;
            }
        }
        
        /**
         * Gets ith "create-timer" element
         */
        public x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer getCreateTimerArray(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer target = null;
                target = (x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer)get_store().find_element_user(CREATETIMER$4, i);
                if (target == null)
                {
                    throw new IndexOutOfBoundsException();
                }
                return target;
            }
        }
        
        /**
         * Returns number of "create-timer" element
         */
        public int sizeOfCreateTimerArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                return get_store().count_elements(CREATETIMER$4);
            }
        }
        
        /**
         * Sets array of all "create-timer" element
         */
        public void setCreateTimerArray(x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer[] createTimerArray)
        {
            synchronized (monitor())
            {
                check_orphaned();
                arraySetterHelper(createTimerArray, CREATETIMER$4);
            }
        }
        
        /**
         * Sets ith "create-timer" element
         */
        public void setCreateTimerArray(int i, x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer createTimer)
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer target = null;
                target = (x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer)get_store().find_element_user(CREATETIMER$4, i);
                if (target == null)
                {
                    throw new IndexOutOfBoundsException();
                }
                target.set(createTimer);
            }
        }
        
        /**
         * Inserts and returns a new empty value (as xml) as the ith "create-timer" element
         */
        public x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer insertNewCreateTimer(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer target = null;
                target = (x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer)get_store().insert_element_user(CREATETIMER$4, i);
                return target;
            }
        }
        
        /**
         * Appends and returns a new empty value (as xml) as the last "create-timer" element
         */
        public x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer addNewCreateTimer()
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer target = null;
                target = (x2.orgJpdl3.jbpm.CreateTimerDocument.CreateTimer)get_store().add_element_user(CREATETIMER$4);
                return target;
            }
        }
        
        /**
         * Removes the ith "create-timer" element
         */
        public void removeCreateTimer(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                get_store().remove_element(CREATETIMER$4, i);
            }
        }
        
        /**
         * Gets a List of "cancel-timer" elements
         */
        public java.util.List<x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer> getCancelTimerList()
        {
            final class CancelTimerList extends java.util.AbstractList<x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer>
            {
                public x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer get(int i)
                    { return EventImpl.this.getCancelTimerArray(i); }
                
                public x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer set(int i, x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer o)
                {
                    x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer old = EventImpl.this.getCancelTimerArray(i);
                    EventImpl.this.setCancelTimerArray(i, o);
                    return old;
                }
                
                public void add(int i, x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer o)
                    { EventImpl.this.insertNewCancelTimer(i).set(o); }
                
                public x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer remove(int i)
                {
                    x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer old = EventImpl.this.getCancelTimerArray(i);
                    EventImpl.this.removeCancelTimer(i);
                    return old;
                }
                
                public int size()
                    { return EventImpl.this.sizeOfCancelTimerArray(); }
                
            }
            
            synchronized (monitor())
            {
                check_orphaned();
                return new CancelTimerList();
            }
        }
        
        /**
         * Gets array of all "cancel-timer" elements
         * @deprecated
         */
        public x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer[] getCancelTimerArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                java.util.List<x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer> targetList = new java.util.ArrayList<x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer>();
                get_store().find_all_element_users(CANCELTIMER$6, targetList);
                x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer[] result = new x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer[targetList.size()];
                targetList.toArray(result);
                return result;
            }
        }
        
        /**
         * Gets ith "cancel-timer" element
         */
        public x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer getCancelTimerArray(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer target = null;
                target = (x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer)get_store().find_element_user(CANCELTIMER$6, i);
                if (target == null)
                {
                    throw new IndexOutOfBoundsException();
                }
                return target;
            }
        }
        
        /**
         * Returns number of "cancel-timer" element
         */
        public int sizeOfCancelTimerArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                return get_store().count_elements(CANCELTIMER$6);
            }
        }
        
        /**
         * Sets array of all "cancel-timer" element
         */
        public void setCancelTimerArray(x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer[] cancelTimerArray)
        {
            synchronized (monitor())
            {
                check_orphaned();
                arraySetterHelper(cancelTimerArray, CANCELTIMER$6);
            }
        }
        
        /**
         * Sets ith "cancel-timer" element
         */
        public void setCancelTimerArray(int i, x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer cancelTimer)
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer target = null;
                target = (x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer)get_store().find_element_user(CANCELTIMER$6, i);
                if (target == null)
                {
                    throw new IndexOutOfBoundsException();
                }
                target.set(cancelTimer);
            }
        }
        
        /**
         * Inserts and returns a new empty value (as xml) as the ith "cancel-timer" element
         */
        public x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer insertNewCancelTimer(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer target = null;
                target = (x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer)get_store().insert_element_user(CANCELTIMER$6, i);
                return target;
            }
        }
        
        /**
         * Appends and returns a new empty value (as xml) as the last "cancel-timer" element
         */
        public x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer addNewCancelTimer()
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer target = null;
                target = (x2.orgJpdl3.jbpm.CancelTimerDocument.CancelTimer)get_store().add_element_user(CANCELTIMER$6);
                return target;
            }
        }
        
        /**
         * Removes the ith "cancel-timer" element
         */
        public void removeCancelTimer(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                get_store().remove_element(CANCELTIMER$6, i);
            }
        }
        
        /**
         * Gets a List of "mail" elements
         */
        public java.util.List<x2.orgJpdl3.jbpm.MailDocument.Mail> getMailList()
        {
            final class MailList extends java.util.AbstractList<x2.orgJpdl3.jbpm.MailDocument.Mail>
            {
                public x2.orgJpdl3.jbpm.MailDocument.Mail get(int i)
                    { return EventImpl.this.getMailArray(i); }
                
                public x2.orgJpdl3.jbpm.MailDocument.Mail set(int i, x2.orgJpdl3.jbpm.MailDocument.Mail o)
                {
                    x2.orgJpdl3.jbpm.MailDocument.Mail old = EventImpl.this.getMailArray(i);
                    EventImpl.this.setMailArray(i, o);
                    return old;
                }
                
                public void add(int i, x2.orgJpdl3.jbpm.MailDocument.Mail o)
                    { EventImpl.this.insertNewMail(i).set(o); }
                
                public x2.orgJpdl3.jbpm.MailDocument.Mail remove(int i)
                {
                    x2.orgJpdl3.jbpm.MailDocument.Mail old = EventImpl.this.getMailArray(i);
                    EventImpl.this.removeMail(i);
                    return old;
                }
                
                public int size()
                    { return EventImpl.this.sizeOfMailArray(); }
                
            }
            
            synchronized (monitor())
            {
                check_orphaned();
                return new MailList();
            }
        }
        
        /**
         * Gets array of all "mail" elements
         * @deprecated
         */
        public x2.orgJpdl3.jbpm.MailDocument.Mail[] getMailArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                java.util.List<x2.orgJpdl3.jbpm.MailDocument.Mail> targetList = new java.util.ArrayList<x2.orgJpdl3.jbpm.MailDocument.Mail>();
                get_store().find_all_element_users(MAIL$8, targetList);
                x2.orgJpdl3.jbpm.MailDocument.Mail[] result = new x2.orgJpdl3.jbpm.MailDocument.Mail[targetList.size()];
                targetList.toArray(result);
                return result;
            }
        }
        
        /**
         * Gets ith "mail" element
         */
        public x2.orgJpdl3.jbpm.MailDocument.Mail getMailArray(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.MailDocument.Mail target = null;
                target = (x2.orgJpdl3.jbpm.MailDocument.Mail)get_store().find_element_user(MAIL$8, i);
                if (target == null)
                {
                    throw new IndexOutOfBoundsException();
                }
                return target;
            }
        }
        
        /**
         * Returns number of "mail" element
         */
        public int sizeOfMailArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                return get_store().count_elements(MAIL$8);
            }
        }
        
        /**
         * Sets array of all "mail" element
         */
        public void setMailArray(x2.orgJpdl3.jbpm.MailDocument.Mail[] mailArray)
        {
            synchronized (monitor())
            {
                check_orphaned();
                arraySetterHelper(mailArray, MAIL$8);
            }
        }
        
        /**
         * Sets ith "mail" element
         */
        public void setMailArray(int i, x2.orgJpdl3.jbpm.MailDocument.Mail mail)
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.MailDocument.Mail target = null;
                target = (x2.orgJpdl3.jbpm.MailDocument.Mail)get_store().find_element_user(MAIL$8, i);
                if (target == null)
                {
                    throw new IndexOutOfBoundsException();
                }
                target.set(mail);
            }
        }
        
        /**
         * Inserts and returns a new empty value (as xml) as the ith "mail" element
         */
        public x2.orgJpdl3.jbpm.MailDocument.Mail insertNewMail(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.MailDocument.Mail target = null;
                target = (x2.orgJpdl3.jbpm.MailDocument.Mail)get_store().insert_element_user(MAIL$8, i);
                return target;
            }
        }
        
        /**
         * Appends and returns a new empty value (as xml) as the last "mail" element
         */
        public x2.orgJpdl3.jbpm.MailDocument.Mail addNewMail()
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.MailDocument.Mail target = null;
                target = (x2.orgJpdl3.jbpm.MailDocument.Mail)get_store().add_element_user(MAIL$8);
                return target;
            }
        }
        
        /**
         * Removes the ith "mail" element
         */
        public void removeMail(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                get_store().remove_element(MAIL$8, i);
            }
        }
        
        /**
         * Gets the "type" attribute
         */
        public java.lang.String getType()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(TYPE$10);
                if (target == null)
                {
                    return null;
                }
                return target.getStringValue();
            }
        }
        
        /**
         * Gets (as xml) the "type" attribute
         */
        public x2.orgJpdl3.jbpm.EventDocument.Event.Type xgetType()
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.EventDocument.Event.Type target = null;
                target = (x2.orgJpdl3.jbpm.EventDocument.Event.Type)get_store().find_attribute_user(TYPE$10);
                return target;
            }
        }
        
        /**
         * Sets the "type" attribute
         */
        public void setType(java.lang.String type)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(TYPE$10);
                if (target == null)
                {
                    target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(TYPE$10);
                }
                target.setStringValue(type);
            }
        }
        
        /**
         * Sets (as xml) the "type" attribute
         */
        public void xsetType(x2.orgJpdl3.jbpm.EventDocument.Event.Type type)
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.EventDocument.Event.Type target = null;
                target = (x2.orgJpdl3.jbpm.EventDocument.Event.Type)get_store().find_attribute_user(TYPE$10);
                if (target == null)
                {
                    target = (x2.orgJpdl3.jbpm.EventDocument.Event.Type)get_store().add_attribute_user(TYPE$10);
                }
                target.set(type);
            }
        }
        /**
         * An XML type(@).
         *
         * This is a union type. Instances are of one of the following types:
         *     x2.orgJpdl3.jbpm.EventDocument$Event$Type$Member
         *     x2.orgJpdl3.jbpm.EventDocument$Event$Type$Member2
         */
        public static class TypeImpl extends org.apache.xmlbeans.impl.values.XmlUnionImpl implements x2.orgJpdl3.jbpm.EventDocument.Event.Type, x2.orgJpdl3.jbpm.EventDocument.Event.Type.Member, x2.orgJpdl3.jbpm.EventDocument.Event.Type.Member2
        {
            private static final long serialVersionUID = 1L;
            
            public TypeImpl(org.apache.xmlbeans.SchemaType sType)
            {
                super(sType, false);
            }
            
            protected TypeImpl(org.apache.xmlbeans.SchemaType sType, boolean b)
            {
                super(sType, b);
            }
            /**
             * An anonymous inner XML type.
             *
             * This is an atomic type that is a restriction of x2.orgJpdl3.jbpm.EventDocument$Event$Type$Member.
             */
            public static class MemberImpl extends org.apache.xmlbeans.impl.values.JavaStringHolderEx implements x2.orgJpdl3.jbpm.EventDocument.Event.Type.Member
            {
                private static final long serialVersionUID = 1L;
                
                public MemberImpl(org.apache.xmlbeans.SchemaType sType)
                {
                    super(sType, false);
                }
                
                protected MemberImpl(org.apache.xmlbeans.SchemaType sType, boolean b)
                {
                    super(sType, b);
                }
            }
            /**
             * An anonymous inner XML type.
             *
             * This is an atomic type that is a restriction of x2.orgJpdl3.jbpm.EventDocument$Event$Type$Member2.
             */
            public static class MemberImpl2 extends org.apache.xmlbeans.impl.values.JavaStringEnumerationHolderEx implements x2.orgJpdl3.jbpm.EventDocument.Event.Type.Member2
            {
                private static final long serialVersionUID = 1L;
                
                public MemberImpl2(org.apache.xmlbeans.SchemaType sType)
                {
                    super(sType, false);
                }
                
                protected MemberImpl2(org.apache.xmlbeans.SchemaType sType, boolean b)
                {
                    super(sType, b);
                }
            }
        }
    }
}
